-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MPA-77_get-events-by-policy #8
base: develop
Are you sure you want to change the base?
Conversation
@@ -11,6 +11,19 @@ class EventApiClient(engine: HttpClientEngine) : IEventApiClient { | |||
|
|||
private val apiHttpClient = ApiHttpClient(engine) | |||
private val httpClient = apiHttpClient.httpClient | |||
override suspend fun getEventsByPolicy(userId: String, policyId: String): Result<List<EventDTO>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newline? :)
if (response.status == HttpStatusCode.OK) { | ||
Result.success(response.body()) | ||
} else { | ||
Result.failure(Exception(response.status.description)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Há algum tipo de documentação ou swagger que diga o tipo de excepções que podem ocorrer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Não, é por isso que decidimos criar uma exception com a mensagem que vem da API
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Só um aparte na organização do projecto: evitem ter packages com nomes genéricos tipo "interfaces". Com o tempo, acabam por ficar cheios de ficheiros baseados no tipo de ficheiro (neste caso, interfaces), em vez de baseado no comportamento/propósito dos ficheiros. Por outras palavras, é mais fácil manter o código a longo prazo se os ficheiros que estão tightly coupled estiverem perto uns dos outros.
Implementation of getting events of an user filtered by a policy